(newra) -*- mode: org; -*-

Help: [C-uc .] insert timestamp [C-cc] flip checkbox [C-uucc] partial flip checkbox [C-ct] flip TODO.

* TODO bugs [9/10]
  * [X] (call-with-input-string "#3()" read) vs (call-with-input-string "#%3()" read)
  * [X] reader loses type when reading rank-0 arrays
  * [X] ra-equal? errors out with mismatched shapes
  * [X] zero lengths break ra-format
  * [X] (ra-dimensions (ra-iota))
  * [X] (ra-reshape (ra-iota) ...) doesn't work
  * [X] (ra-from (list->ra 2 '((a b c) (x y z))) 1 1) => #%0(y) contradicts doc
    - Resolved in 792491e163794d2788b049b071d6cd0740d59c92 <2023-02-16 Thu 09:33>
  * [X] ra-slice-for-each shouldn't return anything
    - Fixed with explicit (values) <2023-02-16 Thu 09:42>
  * [X] define-inlinable-case doesn't inline case-lambda forms
    - Fixed with a patch to guile:module/language/tree-il/peval (3b47f87618047ebb8812788c64a44877a4f2e0dd)
  * [ ] docstrings don't work for define-inlinable-case

* TODO documentation [1/2]
  * [X] actually explain rank extension / prefix matching in the manual
  * [ ] manual lacks a hands on intro 'first (import (newra)) then etc'

* TODO compatibility with existing Guile arrays [8/9]
  * [X] ra-slice-for-each ra-map! ra-for-each ra-cell ra-ref ra-set!
  * [X] ra-transpose ra-reverse
  * [X] make-ra make-ra-shared ra->list list->ra list->typed-ra
  * [X] ra-iota ra-i
  * [X] ra-index-map!
  * [X] ra-shape ra-dimensions
  * [X] ra-root ra-offset
  * [X] ra-equal?
  * [ ] root vectors are equivalent to rank-1 newra objects
  * [ ] return roots for trivial rank-1 views on roots

* TODO whole array functions [9/15]
  * [X] ra-fold
  * [X] ra-any ra-every
  * [X] raw prefix matching
  * [X] generalized prefix matching
  * [-] high level slicing [3/4]
    - [X] ra-from
    - [X] ra-amend!
    - [X] (dots)
    - [ ] axis insertion (?)
  * [X] ra-ravel
    - [X] (ra-ravel a [n])
    - [X] (ra-order-c? a [n [org]])
    - [X] (ra-ravel a [n [org]])
  * [X] ra-tile [2/2]
    - [X] accept arbitrary axis
    - [X] can produce dead axes
  * [X] ra-cat (ra-cat, ra-cats)
    - [X] implementation
    - [X] tests
    - [X] tests with non-zero base indices
  * [X] ra-reshape [3/3]
    - [X] basic function
    - [X] accept arbitrary axis
    - [X] placeholder
  * [X] ra-clip
  * [ ] ra-grade
  * [-] ra-rotate [1/2]
    - [X] ra-rotate!
    - [ ] ra-rotate that isn't just (ra-rotate! n (ra-copy x))
  * [ ] as-ra
  * [ ] ra-filter, ra-select, etc.
  * [ ] ra-affine map that explicitly takes an [M×(N+1)] matrix

* TODO misc array manipulation [0/1]
  * [ ] mapping of indices (beyond ra-reshape/ra-from). Maybe just explain in manual?

* TODO fundamental features [3/7]
  * [X] unsized index vectors
  * [X] tensor indices
  * [X] broadcasting
  * [ ] reader handles quasiquote
  * [ ] ways to control iteration (in order, dim loop order, direction, etc.)
  * [ ] a solution for (ra-amend! dst (RA-MAP OP (ra-from dst i ...)) i ...). Lenses?
  * [ ] separate somehow the rank matching cases that can be done in parallel from those that
    cannot, e.g. using lower rank dest arg to perform reductions.

* TODO array language [/]
  * [ ] drag-along facility / lazy ops
    - [ ] verbs
    - [ ] rank conjunction
    - [ ] each (cf array-curry in srfi-179 or the old Guile array-enclose).
  * [ ] output types

* TODO performance [2/4]
  * [X] u8 ra-fill! vs native (see bench.scm) ok in 3.0.8 with partial bytevector-fill!
  * [X] f64 ra-copy! vs native (see bench.scm)
  * [ ] ra-ref / ra-set! with 1 or 2 args vs built-in array-ref / array-set!
  * [ ] ra->list / list->ra vs built-in array->list / list->array. Maybe those can be reused?

* TODO friendlier undefined sizes [2/6]
  * [X] printing of 'd typed arrays
  * [X] printing with dead axes
  * [ ] reading of 'd typed arrays
  * [ ] printing with infinite axes
  * [ ] reading of arrays with inf axes
  * [ ] reading of arrays with dead axes

* TODO quality of life [2/15]
  * [X] make (ra ...) work with generalized slices just like (ra-from ...).
  * [ ] make (set! (ra ...) o) work with slices (now) or generalized slices (eventually) just like (ra ...).
  * [X] rank-1 ops in the unrolled section (e.g. bytevector-copy!, bytevector-fill!).
  * [ ] precompute fixed parameters of rank-1 ops (len, step).
    - These can be used to improve the rank-1 op choice heuristic, and also not to rely on iteration order assumption.
  * [ ] rank-2 ops or higher in the unrolled section (e.g. blis-dcopym!, blis-dsetm!).
  * [ ] rank-1 (or higher!) cases for generating functions (e.g. array->list).
  * [ ] the reverse of ra-singletonize, find a good name (see 'differences with numpy' in the doc).
  * [ ] automatic handling of scalars (e.g. (ra-map #f + (ra-iota 3) 99) works).
  * [ ] refactor macros
  * [ ] bench tracking
  * [ ] move struct defs to (newra types)
  * [ ] ra-unique-elements?
  * [-] pretty printer [4/6]
    - [X] basic ra-format
    - [X] print sizes in prefix
    - [X] CL/SRFI-163 style rank-0 (e.g. '#0 x' instead of '#0(x)').
    - [X] compact mode
    - [ ] handle unbounded axes
    - [ ] auto truncation
  * [-] an ffi to Fortran based on iso_c_binding, be able to pass arrays & scalars at least [3/6]
    - [X] fix rank 0
    - [X] fix non-zero ra-offset
    - [X] verify behavior of lbounds
    - [-] fortran-library-function [3/7]
      + [X] c32/c64
      + [X] fix arg-types format
      + [X] working example with intent(inout)
      + [ ] support intent(out) array args (need array-mutable?)
      + [ ] logical <-> bool (need libffi / Guile ffi support)
      + [ ] value, arguments, like real(C_FLOAT), value :: x
      + [ ] support out args, e.g. with boxes (?)
    - [ ] fix alignment assumptions (seems there's padding in some versions of ISO_Fortran_binding.h :-/)
    - [ ] modulize, test, doc, etc.
  * [ ] connections to other libraries
    - [ ] BLIS
      + [ ] fix unbound variable compilation warnings when (import (ffi blis)) fails.
    - [ ] fftw

* TODO other [0/1]
  * [ ] review definition of (ra-untranspose a i ...). Does it make sense to allow any i < (rank a) ?
* TODO packaging [1/3]
  * [X] Global CMakeLists.txt
  * [ ] Autoconf (?)
  * [ ] Installation
* TODO replace Guile arrays [0/5]
  * [ ] truncated-print support
  * [ ] equal? support
  * [ ] hooks into C / libguile
  * [ ] compilation of literals
  * [ ] replace all names
